package Jvm;

import javax.xml.bind.SchemaOutputResolver;
import java.util.concurrent.Semaphore;

/**
 * Created by kai on 2015/8/17 0017.
 */
public class Semphore {
    public static void main(String[] args) throws InterruptedException {
        Semaphore semaphore = new Semaphore(0);
        semaphore.release(3);//发出去三个凭证
        semaphore.acquire();
        semaphore.acquire();
        System.out.println(semaphore.availablePermits());
    }
}
